package com.ex.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ex.dao.UserDao;
import com.ex.model.User;

// @Compontent  定义1个bean 
//          业务层一般用@Service
@Service
public class UserService {
	
	// userDao 应该是由spring来创建
	
	@Autowired
	private UserDao userDao;
	
	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public List<User> queryUser(Integer id){
		// UserDao dao = new UserDao();
		// List<User> list = dao.queryUser(id);
		List<User> list = userDao.queryUser(id);
		if(list.size() == 0){
			return null;
		} 
		return list;
	}
}
